using AutoMapper;
using Pay.DTO;
using Pay.Data;
using Pay.IService;
using Pay.Core;

namespace Pay.Service.AutoMapper {
    public class UserSoupValueHisMapper : IStartupDto {
        private IMapperConfigurationExpression _cfg;
        public UserSoupValueHisMapper(IMapperConfigurationExpression cfg) {
            _cfg = cfg;
        }
        public void Execute() {
            Create();
        }
        protected virtual void Create() {
            _cfg.CreateMap<UserSoupValueHis, user_soup_value_his_dto>()
                .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
                .ForMember(dest => dest.user_id, src => src.MapFrom(c => c.UserId))
                .ForMember(dest => dest.task_type, src => src.MapFrom(c => c.TaskType))
                .ForMember(dest => dest.item_id, src => src.MapFrom(c => c.ItemId))
                .ForMember(dest => dest.soup_value, src => src.MapFrom(c => c.SoupValue))
                .ForMember(dest => dest.create_time, src => src.MapFrom(c => c.CreateTime.ToDateTime()))
                .ForMember(dest => dest.effective_time, src => src.MapFrom(c => c.EffectiveTime.ToDateTime()))
                .ForMember(dest => dest.merchant, src => src.MapFrom(c => c.Merchant));
        }
    }
}
